





# 请写出一个4*4*4的数组，数组的值是1-64
import numpy as np

array_3d = np.arange(1, 65).reshape(4, 4, 4)
print(array_3d)
print("\n数组的形状:", array_3d.shape)


b=np.arange(1,64)
b


b[2:59:2]


import numpy as np

a = range(1,129)
a = np.array(a)

a.shape = (16,8)
a


a[0:17:2,0:9:2]


a[1:,1:]


a[1:-1,1:-1]


import numpy as np

b = range(1,129)
b = np.array(b)

b.shape = (8,4,4)
b


b[0:,1:-1,1:-1]


import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

import matplotlib.image as mpimg

m31 = mpimg.imread('m31.jpg')

fig = plt.figure(figsize=(8,8))

img0plot = plt.imshow(cyclist)

plt.show()


print(type(m31))


m31.ndim


m31.shape


c = m31[50:250,1500:1700,0:3]
d = plt.imshow(c)
plt.show()


e = m31[:,:,0]
g = m31[:,:,1]
h = m31[:,:,2]
fig,axs = plt.subplots(1,3,figsize=(9,3))
axs[0].imshow(e,cmap = 'Reds')
axs[1].imshow(g,cmap = 'Greens')
axs[2].imshow(h,cmap = 'Blues')
plt.tight_layout()
plt.show()


i = g-e
j = plt.imshow(i,cmap = 'Greys')
plt.show()


i.max(),i.min()


import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

img = np.zeros((1024,1024))
detype


img.shape


import matplotlib.pyplot as plt
import matplotlib.patches as patches
fig,ax=plt.subplots(1,1,figsize=(4,4))
wireframe=patches.Rectangle((0,0),4,3,linewidth=2,edgecolor="yellow",facecolor="yellow")
ax.add_patch(wireframe)
ax.plot([0,4],[0,3],"r-",linewidth=2)
ax.plot([0,4],[3,0],"r-",linewidth=2)
ax.set_xlim(0,4)
ax.set_ylim(0,3)
ax.set_aspect("equal")
ax.set_title("jvxing")
plt.show()




